MAKE                =	make
CC                  =	g++
INCPATH             =   ./include
EXE                 =   cppTutorTest
STATIC_TEST         =   libcppTutorTest.a
SHARED_TEST         =   libcppTutorTest.so
CPPOX               =   -std=c++0x
LINK                =	-g -pedantic -Wall -lstdc++ -lpthread -ldl -lm -Wl,-rpath,.
COMPILE	            =	-g -O0 $(CPPOX) -D_THREAD_SAFE -Wextra -pedantic -Wall -c -Wno-deprecated 
SRCS                =   $(shell ls *.cpp)
SRCS_C              =   $(shell ls *.c)
OBJS                =   $(subst .cpp,.o,$(SRCS))
OBJS_C              =   $(subst .c,.o,$(SRCS_C))

.SUFFIXES: .o .cpp .c

.cpp.o:
	$(CC) -I $(INCPATH) $(COMPILE) $<

.c.o:
	$(CC) -I $(INCPATH) $(COMPILE) $<

all: $(OBJS) $(OBJS_C)
	$(CC) -o $(EXE) $(OBJS) $(OBJS_C) -L. $(LINK) 

-include depend.mak

depend:
	g++ -MM $(SRCS) > depend.mak

shared: $(OBJS)
	$(CC) -shared -Wl,-soname -lc -o $(SHARED_TEST) $(OBJS) -L.

static: $(OBJS)
	ar rucvs $(STATIC_TEST) $(OBJS)

clean:
	rm -rf $(OBJS) $(OBJS_C) depend.mak $(EXE)

cleanapp:
	rm -rf $(EXE)

distclean:
	rm -rf $(OBJS) $(OBJS_C) depend.mak $(EXE)

